<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,com.jobportal.MyFunctions"%>

<HEAD>


	<script LANGUAGE="Javascript" SRC="Images/validate.js"></script>


	<LINK href="styles.css" type="text/css" rel="stylesheet">

</HEAD>
<BODY class=Grad>
<h2 align=center>Add New Walk-in</h2>

<%

	Connection con=null;
	ResultSet rs=null;
	Statement stmt=null;
		String WalkinID = "";	
	MyFunctions MF = new MyFunctions();
	WalkinID = MF.genNextID("walkindetails","WalkinID","WALK-IN");
	String JobTitle = request.getParameter("JobTitle");	
	String JobDescription = request.getParameter("JobDescription");
	String Eligibility = request.getParameter("Eligibility");	
	String Location = request.getParameter("Location");	
	String WalkinDate = request.getParameter("WalkinDate");	
	String WalkinTime = request.getParameter("WalkinTime");	
	String CompanyName = request.getParameter("CompanyName");	
	String CompanyDescription = request.getParameter("CompanyDescription");
	String Address = request.getParameter("Address");	
	String Website = request.getParameter("Website");	
	String EmailToRegister = request.getParameter("EmailToRegister");	
	String FunctionalArea = request.getParameter("FunctionalArea");
		System.out.println("WalkinDate "+WalkinDate);
	try{
			
			/* Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con = DriverManager.getConnection("jdbc:odbc:JobPortal","root",""); */

			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
	
			
			String Query = "Insert into walkindetails values('"+WalkinID+"','"+JobTitle+"','"+JobDescription+"','"+Eligibility+"','"+Location+"','"+WalkinDate+"','"+WalkinTime+"','"+CompanyName+"','"+CompanyDescription+"','"+Address+"','"+Website+"','"+EmailToRegister+"','"+FunctionalArea+"')";
			int result = stmt.executeUpdate(Query);
			if( result > 0)	{
				%><h3 align=center>Inserted into database sucessfully</h3><%
			}
			else{
				%><h3 align=center>Error in updating..please try again</h3><% 
			}
			stmt.close();
			con.close();
		}catch(Exception e){
			stmt.close();
			con.close();
			%><%=e%><%
		}
	
%>
</BODY>
